<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>ts的扩展信息 | wiki小站 生活-代码之道</title>
  <meta name="keywords" content=" ts的扩展 ">
  <meta name="description" content="ts的扩展信息 | wiki小站 生活-代码之道">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="description" content="前言播放视频或者渲染其他的动画的时候，有两个 View 组件可供选择，SurfaceView 和 TextureView，GLSurfaceView 是 SurfaceView 的子类，在 SurfaceView 基础上封装了 EGL 环境管理以及 Render 线程，专用于 3D 游戏开发的视图，这里归类到 SurfaceView 中。在介绍 SurfaceView 与 TextureView">
<meta property="og:type" content="article">
<meta property="og:title" content="SurfaceView 与 TextureView 详解">
<meta property="og:url" content="https://xu-genyin.gitee.io/2024/01/24/android/SurfaceViewAndTextureView/">
<meta property="og:site_name" content="wiki小站 生活-代码之道">
<meta property="og:description" content="前言播放视频或者渲染其他的动画的时候，有两个 View 组件可供选择，SurfaceView 和 TextureView，GLSurfaceView 是 SurfaceView 的子类，在 SurfaceView 基础上封装了 EGL 环境管理以及 Render 线程，专用于 3D 游戏开发的视图，这里归类到 SurfaceView 中。在介绍 SurfaceView 与 TextureView">
<meta property="og:locale" content="zh_CN">
<meta property="article:published_time" content="2024-01-23T16:00:00.000Z">
<meta property="article:modified_time" content="2024-01-24T03:20:39.499Z">
<meta property="article:author" content="树根">
<meta property="article:tag" content="安卓开发">
<meta name="twitter:card" content="summary">


<link rel="icon" href="/img/avatar.jpg">

<link href="/css/style.css?v=1.1.0" rel="stylesheet">

<link href="/css/hl_theme/github.css?v=1.1.0" rel="stylesheet">

<link href="//cdn.jsdelivr.net/npm/animate.css@4.1.0/animate.min.css" rel="stylesheet">

<link href="//cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.css" rel="stylesheet">
<link href="//cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/default-skin/default-skin.min.css" rel="stylesheet">

<script src="//cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script>
<script src="/js/titleTip.js?v=1.1.0" ></script>

<script src="//cdn.jsdelivr.net/npm/highlightjs@9.16.2/highlight.pack.min.js"></script>
<script>
    hljs.initHighlightingOnLoad();
</script>

<script src="//cdn.jsdelivr.net/npm/nprogress@0.2.0/nprogress.min.js"></script>



<script src="//cdn.jsdelivr.net/npm/jquery.cookie@1.4.1/jquery.cookie.min.js" ></script>

<script src="/js/iconfont.js?v=1.1.0" ></script>

<meta name="generator" content="Hexo 5.4.2"></head>
<div style="display: none">
  <input class="theme_disqus_on" value="false">
  <input class="theme_preload_comment" value="">
  <input class="theme_blog_path" value="">
  <input id="theme_shortcut" value="true" />
  <input id="theme_highlight_on" value="true" />
  <input id="theme_code_copy" value="true" />
</div>



<body>
<aside class="nav">
    <div class="nav-left">
        <a href="/"
   class="avatar_target">
    <img class="avatar"
         src="/img/avatar.jpg"/>
</a>
<div class="author">
    <span>树根</span>
</div>

<div class="icon">
    
        
            <a title="email"
               href="mailto:xuxian.xgy@gmail.com"
               target="_blank">
                
                    <svg class="iconfont-svg" aria-hidden="true">
                        <use xlink:href="#icon-email"></use>
                    </svg>
                
            </a>
        
    
        
            <a title="qq"
               href="http://wpa.qq.com/msgrd?v=3&uin=553503639&site=qq&menu=yes"
               target="_blank">
                
                    <svg class="iconfont-svg" aria-hidden="true">
                        <use xlink:href="#icon-qq"></use>
                    </svg>
                
            </a>
        
    
</div>





<ul>
    <li>
        <div class="all active" data-rel="全部文章">全部文章
            
                <small>(10)</small>
            
        </div>
    </li>
    
        
            
                
    <li>
        <div data-rel="安卓开发">
            
            安卓开发
            <small>(3)</small>
        </div>
        
    </li>

            
        
    
        
            
                
    <li>
        <div data-rel="博客的故事">
            
            博客的故事
            <small>(2)</small>
        </div>
        
    </li>

            
        
    
        
            
                
    <li>
        <div data-rel="chromium">
            
            chromium
            <small>(1)</small>
        </div>
        
    </li>

            
        
    
        
            
                
    <li>
        <div data-rel="git">
            
            git
            <small>(1)</small>
        </div>
        
    </li>

            
        
    
        
            
                
    <li>
        <div data-rel="TreeNet">
            
            TreeNet
            <small>(1)</small>
        </div>
        
    </li>

            
        
    
        
            
                
    <li>
        <div data-rel="typescript">
            
            typescript
            <small>(2)</small>
        </div>
        
    </li>

            
        
    
</ul>
<div class="left-bottom">
    <div class="menus">
        
    </div>
    <div>
        
        <a 
                                           class="friends">友链</a>
        
    </div>
</div>
<input type="hidden" id="yelog_site_posts_number" value="10">
<input type="hidden" id="yelog_site_word_count" value="7.6k">
<div style="display: none">
    <span id="busuanzi_value_site_uv"></span>
    <span id="busuanzi_value_site_pv"></span>
</div>

    </div>
    <div class="nav-right">
        <div class="friends-area">
    <div class="friends-title">
        友情链接
        <i class="iconfont icon-left"></i>
    </div>
    <div class="friends-content">
        <ul>
            
            <li><a target="_blank" href="https://gitee.com/xu-genyin/">gitee</a></li>
            
            <li><a target="_blank" href="http://yelog.org/">xx</a></li>
            
        </ul>
    </div>
</div>
        <div class="title-list">
    <div class="right-top">
        <div id="default-panel">
            <i class="iconfont icon-search" data-title="搜索 快捷键 i"></i>
            <div class="right-title">全部文章</div>
            <i class="iconfont icon-file-tree" data-title="切换到大纲视图 快捷键 w"></i>
        </div>
        <div id="search-panel">
            <i class="iconfont icon-left" data-title="返回"></i>
            <input id="local-search-input" autocomplete="off"/>
            <label class="border-line" for="input"></label>
            <i class="iconfont icon-case-sensitive" data-title="大小写敏感"></i>
            <i class="iconfont icon-tag" data-title="标签"></i>
        </div>
        <div id="outline-panel" style="display: none">
            <div class="right-title">大纲</div>
            <i class="iconfont icon-list" data-title="切换到文章列表"></i>
        </div>
    </div>

    <div class="tags-list">
    <input id="tag-search" />
    <div class="tag-wrapper">
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>安卓开发</a>
            </li>
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>搭建本站</a>
            </li>
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>chromium</a>
            </li>
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>git使用</a>
            </li>
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>TreeNet</a>
            </li>
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>ts</a>
            </li>
        
            <li class="article-tag-list-item">
                <i class="iconfont icon-tag"></i><a>ts的扩展</a>
            </li>
        
    </div>

</div>

    
    <div id="local-search-result">

    </div>
    
    <nav id="title-list-nav">
        
        
        <a  class="全部文章 安卓开发 "
           href="/2024/01/24/android/SurfaceViewAndTextureView/"
           data-tag="安卓开发"
           data-author="treeroot" >
            <span class="post-title" title="SurfaceView 与 TextureView 详解">SurfaceView 与 TextureView 详解</span>
            <span class="post-date" title="2024-01-24 00:00:00">2024/01/24</span>
        </a>
        
        
        <a  class="全部文章 chromium "
           href="/2023/11/23/chromium/core/"
           data-tag="chromium"
           data-author="treeroot" >
            <span class="post-title" title="【chromium内核笔记】源码结构篇">【chromium内核笔记】源码结构篇</span>
            <span class="post-date" title="2023-11-23 08:46:00">2023/11/23</span>
        </a>
        
        
        <a  class="全部文章 安卓开发 "
           href="/2023/11/14/android/okhttp/"
           data-tag="安卓开发"
           data-author="小广～" >
            <span class="post-title" title="OkHttp">OkHttp</span>
            <span class="post-date" title="2023-11-14 14:21:00">2023/11/14</span>
        </a>
        
        
        <a  class="全部文章 TreeNet "
           href="/2023/11/03/treenet/instruction/"
           data-tag="TreeNet"
           data-author="" >
            <span class="post-title" title="开源网关项目：TreeNet">开源网关项目：TreeNet</span>
            <span class="post-date" title="2023-11-03 16:15:54">2023/11/03</span>
        </a>
        
        
        <a  class="全部文章 typescript "
           href="/2023/10/27/typescript/tsExtends/"
           data-tag="ts的扩展"
           data-author="" >
            <span class="post-title" title="ts的扩展信息">ts的扩展信息</span>
            <span class="post-date" title="2023-10-27 11:15:54">2023/10/27</span>
        </a>
        
        
        <a  class="全部文章 typescript "
           href="/2023/10/27/typescript/whyToUse/"
           data-tag="ts"
           data-author="" >
            <span class="post-title" title="为什么要使用typeScript">为什么要使用typeScript</span>
            <span class="post-date" title="2023-10-27 11:15:54">2023/10/27</span>
        </a>
        
        
        <a  class="全部文章 git "
           href="/2023/10/27/git/useGit/"
           data-tag="git使用"
           data-author="" >
            <span class="post-title" title="使用git">使用git</span>
            <span class="post-date" title="2023-10-27 08:38:54">2023/10/27</span>
        </a>
        
        
        <a  class="全部文章 安卓开发 "
           href="/2023/10/25/android/activityAndFragment/"
           data-tag="安卓开发"
           data-author="小广～" >
            <span class="post-title" title="Activity和Fragment生命周期">Activity和Fragment生命周期</span>
            <span class="post-date" title="2023-10-25 15:52:14">2023/10/25</span>
        </a>
        
        
        <a  class="全部文章 博客的故事 "
           href="/2023/10/25/blog/toHaveSameSite/"
           data-tag="搭建本站"
           data-author="" >
            <span class="post-title" title="如何去搭建同款本站">如何去搭建同款本站</span>
            <span class="post-date" title="2023-10-25 08:54:14">2023/10/25</span>
        </a>
        
        
        <a  class="全部文章 博客的故事 "
           href="/2023/10/23/blog/start/"
           data-tag=""
           data-author="" >
            <span class="post-title" title="关于这个小破站">关于这个小破站</span>
            <span class="post-date" title="2023-10-23 22:04:14">2023/10/23</span>
        </a>
        
        <div id="no-item-tips">

        </div>
    </nav>
    <div id="outline-list">
    </div>
</div>

    </div>
    <div class="hide-list">
        <div class="semicircle" data-title="切换全屏 快捷键 s">
            <div class="brackets first"><</div>
            <div class="brackets">&gt;</div>
        </div>
    </div>
</aside>
<div id="post">
    <div class="pjax">
        <article id="post-typescript/tsExtends" class="article article-type-post" itemscope itemprop="blogPost">
    
        <h1 class="article-title">ts的扩展信息</h1>
    
    <div class="article-meta">
        
        
        
        <span class="book">
            <i class="iconfont icon-category"></i>
            
            
            <a  data-rel="typescript">typescript</a>
            
        </span>
        
        
        <span class="tag">
            <i class="iconfont icon-tag"></i>
            
            <a class="color1">ts的扩展</a>
            
        </span>
        
    </div>
    <div class="article-meta">
        
            发布时间 : <time class="date" title='最后更新: 2023-10-27 11:26:18'>2023-10-27 11:15</time>
        
    </div>
    <div class="article-meta">
        
        <span>字数:258</span>
        
        
        <span id="busuanzi_container_page_pv">
            阅读 :<span id="busuanzi_value_page_pv">
                <span class="count-comment">
                    <span class="spinner">
                      <div class="cube1"></div>
                      <div class="cube2"></div>
                    </span>
                </span>
            </span>
        </span>
        
        
    </div>
    
    <div class="toc-ref">
    
        <ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#typescript%E4%B8%AD%E7%9A%84class%E4%B8%8Einterface%E7%9A%84%E5%8C%BA%E5%88%AB"><span class="toc-text">typescript中的class与interface的区别</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E5%8E%BB%E5%AE%9A%E4%B9%89interface%E7%9A%84%E6%89%A9%E5%B1%95"><span class="toc-text">去定义interface的扩展</span></a></li></ol>
    
<style>
    .left-col .switch-btn,
    .left-col .switch-area {
        display: none;
    }
    .toc-level-4 i,
    .toc-level-4 ol {
        display: none !important;
    }
</style>
</div>

    
    <div class="article-entry" itemprop="articleBody">
      
        <h1 id="typescript中的class与interface的区别"><a href="#typescript中的class与interface的区别" class="headerlink" title="typescript中的class与interface的区别"></a>typescript中的class与interface的区别</h1><blockquote>
<p>这个标题其实我想表达的是为什么我几乎不曾用过class</p>
</blockquote>
<p>typescript中声明一个类型，我们通常会有两种做法：</p>
<p>1.使用class</p>
<pre><code class="typescript">  export default class state &#123;
    userInfo: &#123;
        name: string,
        age: number
    &#125;
&#125;
</code></pre>
<p>2.使用interface</p>
<pre><code class="typescript"> export interface STATE &#123;
    userInfo : &#123;
        name: string,
        age: number
    &#125;
&#125;
</code></pre>
<p>那么这两种声明类型的方案有什么区别？<br>typescript的宗旨是兼容js,因此interface在运行时是会被完全消除的。而class经过编译后，在运行时依然存在。<br>结论：如果要声明的类型只是纯粹的类型信息，只需要声明interface即可。</p>
<h1 id="去定义interface的扩展"><a href="#去定义interface的扩展" class="headerlink" title="去定义interface的扩展"></a>去定义interface的扩展</h1><pre><code class="typescript">//某编辑组件的props
export interface NewOrEditProps &#123;
    editId?: string; //编辑的id
    visible?: boolean;//该组件是否显示
    changeVisible?: (e: any) =&gt; void;//改变该组件显示状态的方法
&#125;
/**
 * 用户信息继承了NewOrEditProps
 */
export interface User  extends NewOrEditProps&#123;
    id: number;
    userName: string;
    nickName: string;
    passWord: string;
&#125;

//使用：
//新建/编辑组件
const NewOrEditWrapper = (props: NewOrEditProps) =&gt; &#123;
    return &lt;NewOrEdit &#123;...props&#125; /&gt;;
&#125;;
</code></pre>

      
       <hr><span style="font-style: italic;color: gray;"> 欢迎指出任何有错误或不够清晰的表达。也可以邮件至 xuxian.xgy@gmail.com </span>
    </div>
</article>


<p>
    <a  class="dashang" onclick="dashangToggle()">赏</a>
</p>


<div class="article_copyright">
    <p><span class="copy-title">文章标题:</span>ts的扩展信息</p>
    <p><span class="copy-title">字数:</span><span class="post-count">258</span></p>
    <p><span class="copy-title">本文作者:</span><a  title="树根">树根</a></p>
    <p><span class="copy-title">发布时间:</span>2023-10-27, 11:15:54</p>
    <p><span class="copy-title">最后更新:</span>2023-10-27, 11:26:18</p>
    <span class="copy-title">原始链接:</span><a class="post-url" href="/2023/10/27/typescript/tsExtends/" title="ts的扩展信息">https://xu-genyin.gitee.io/2023/10/27/typescript/tsExtends/</a>
    <p>
        <span class="copy-title">版权声明:</span><i class="fa fa-creative-commons"></i> <a rel="license noopener" target="_blank" href="http://creativecommons.org/licenses/by-nc-sa/4.0/" title="CC BY-NC-SA 4.0 International" target = "_blank">&#34;署名-非商用-相同方式共享 4.0&#34;</a> 转载请保留原文链接及作者。
    </p>
</div>





    




    </div>
    <div class="copyright">
        <p class="footer-entry">
    git，记录程序员美好生活～欢迎投稿 邮件至 xuxian.xgy@gmail.com
</p>
<p class="footer-entry">Built with <a href="https://hexo.io/" target="_blank">Hexo</a> and <a href="https://github.com/yelog/hexo-theme-3-hexo" target="_blank">3-hexo</a> theme</p>

    </div>
    <div class="full-toc">
        <button class="full" data-title="切换全屏 快捷键 s"><span class="min "></span></button>
<a class="" id="rocket" ></a>

    </div>
</div>

<div class="hide_box" onclick="dashangToggle()"></div>
<div class="shang_box">
    <a class="shang_close"  onclick="dashangToggle()">×</a>
    <div class="shang_tit">
        <p>看官，赏个咖啡～</p>
    </div>
    <div class="shang_payimg">
        <div class="pay_img">
            <img src="/img/alipay.jpg" class="alipay" title="扫码支持">
            <img src="/img/weixin.jpg" class="weixin" title="扫码支持">
        </div>
    </div>
    <div class="shang_payselect">
        <span><label><input type="radio" name="pay" checked value="alipay">支付宝</label></span><span><label><input type="radio" name="pay" value="weixin">微信</label></span>
    </div>
</div>


</body>
<script src="/js/jquery.pjax.js?v=1.1.0" ></script>

<script src="//cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe.min.js"></script>
<script src="//cdn.jsdelivr.net/npm/photoswipe@4.1.3/dist/photoswipe-ui-default.min.js"></script>

<script src="/js/script.js?v=1.1.0" ></script>
<script>
    var img_resize = 'photoSwipe';
    function initArticle() {
        /*渲染对应的表格样式*/
        
            $("#post .pjax table").addClass("green_title");
        

        /*渲染打赏样式*/
        
        $("input[name=pay]").on("click", function () {
            if($("input[name=pay]:checked").val()=="weixin"){
                $(".shang_box .shang_payimg .pay_img").addClass("weixin_img");
            } else {
                $(".shang_box .shang_payimg .pay_img").removeClass("weixin_img");
            }
        })
        

        /*高亮代码块行号*/
        

        /*访问数量*/
        
        $.getScript("//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js");
        

        /*代码高亮，行号对齐*/
        $('.pre-numbering').css('line-height',$('.has-numbering').css('line-height'));

        

        // PhotoSwipe
        $('article').each(function(i){
            $(this).find('img').each(function(){
                if ($(this).closest('figure').hasClass('article-gallery-img')) {
                    return;
                }
                var alt = this.alt;
                $(this)
                    .wrap('<figure class="article-gallery-img" itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject"></figure>')
                    .wrap('<a href="' + this.src + '" title="' + alt + '"></a>');
                $(this).after('<div class="img_alt"><span>' + (alt || '') + '</span></div>');
            });
        });

        var pswpElement = document.querySelectorAll('.pswp')[0];
        if (pswpElement) {
            var gallerySelector = '.article-gallery, article';

            var initPhotoSwipeFromDOM = function(gallerySelector) {

                // parse slide data (url, title, size ...) from DOM elements
                // (children of gallerySelector)
                var parseThumbnailElements = function(el) {
                    var thumbElements = $(el).find('figure.article-gallery-img').toArray(),
                        numNodes = thumbElements.length,
                        items = [],
                        figureEl,
                        linkEl,
                        size,
                        imgEl,
                        item;

                    for (var i = 0; i < numNodes; i++) {

                        figureEl = thumbElements[i]; // <figure> element

                        // include only element nodes
                        if (figureEl.nodeType !== 1) {
                            continue;
                        }

                        linkEl = figureEl.children[0]; // <a> element
                        imgEl = linkEl.children[0]; // <img>

                        size = linkEl.getAttribute('data-size');
                        size = size && size.split('x');

                        // create slide object
                        item = {
                            src: linkEl.getAttribute('href'),
                            w: size && parseInt(size[0], 10) || imgEl.width,
                            h: size && parseInt(size[1], 10) || imgEl.height
                        };

                        if (figureEl.children.length > 1) {
                            // <figcaption> content
                            item.title = figureEl.children[1].innerHTML;
                        }

                        if (linkEl.children.length > 0) {
                            // <img> thumbnail element, retrieving thumbnail url
                            item.msrc = linkEl.children[0].getAttribute('src');
                        }

                        item.el = figureEl; // save link to element for getThumbBoundsFn
                        items.push(item);
                    }

                    return items;
                };

                // find nearest parent element
                var closest = function closest(el, fn) {
                    return el && (fn(el) ? el : closest(el.parentNode, fn));
                };

                // triggers when user clicks on thumbnail
                var onThumbnailsClick = function(e) {
                    e = e || window.event;

                    var eTarget = e.target || e.srcElement;

                    // find root element of slide
                    var clickedListItem = closest(eTarget, function(el) {
                        return (el.tagName && el.tagName.toUpperCase() === 'FIGURE');
                    });

                    if (!clickedListItem) {
                        return;
                    }

                    if (e.preventDefault) {
                        e.preventDefault();
                    } else {
                        e.returnValue = false;
                    }

                    // find index of clicked item by looping through all child nodes
                    // alternatively, you may define index via data- attribute
                    var clickedGallery = $(clickedListItem).closest(gallerySelector)[0],
                        childNodes = $(clickedGallery).find('figure.article-gallery-img').toArray(),
                        numChildNodes = childNodes.length,
                        nodeIndex = 0,
                        index;

                    for (var i = 0; i < numChildNodes; i++) {
                        if (childNodes[i].nodeType !== 1) {
                            continue;
                        }

                        if (childNodes[i] === clickedListItem) {
                            index = nodeIndex;
                            break;
                        }
                        nodeIndex++;
                    }



                    if (index >= 0) {
                        // open PhotoSwipe if valid index found
                        openPhotoSwipe(index, clickedGallery);
                    }
                    return false;
                };

                // parse picture index and gallery index from URL (#&pid=1&gid=2)
                var photoswipeParseHash = function() {
                    var hash = window.location.hash.substring(1),
                        params = {};

                    if (hash.length < 5) {
                        return params;
                    }

                    var vars = hash.split('&');
                    for (var i = 0; i < vars.length; i++) {
                        if (!vars[i]) {
                            continue;
                        }
                        var pair = vars[i].split('=');
                        if (pair.length < 2) {
                            continue;
                        }
                        params[pair[0]] = pair[1];
                    }

                    if (params.gid) {
                        params.gid = parseInt(params.gid, 10);
                    }

                    return params;
                };

                var openPhotoSwipe = function(index, galleryElement, disableAnimation, fromURL) {
                    var pswpElement = document.querySelectorAll('.pswp')[0],
                        gallery,
                        options,
                        items;

                    items = parseThumbnailElements(galleryElement);

                    // define options (if needed)
                    options = {

                        // define gallery index (for URL)
                        galleryUID: galleryElement.getAttribute('data-pswp-uid'),

                        getThumbBoundsFn: function(index) {
                            // See Options -> getThumbBoundsFn section of documentation for more info
                            var thumbnail = items[index].el.getElementsByTagName('img')[0], // find thumbnail
                                pageYScroll = window.pageYOffset || document.documentElement.scrollTop,
                                rect = thumbnail.getBoundingClientRect();

                            return {
                                x: rect.left,
                                y: rect.top + pageYScroll,
                                w: rect.width
                            };
                        }
                    };

                    // PhotoSwipe opened from URL
                    if (fromURL) {
                        if (options.galleryPIDs) {
                            // parse real index when custom PIDs are used
                            // http://photoswipe.com/documentation/faq.html#custom-pid-in-url
                            for (var j = 0; j < items.length; j++) {
                                if (items[j].pid == index) {
                                    options.index = j;
                                    break;
                                }
                            }
                        } else {
                            // in URL indexes start from 1
                            options.index = parseInt(index, 10) - 1;
                        }
                    } else {
                        options.index = parseInt(index, 10);
                    }

                    // exit if index not found
                    if (isNaN(options.index)) {
                        return;
                    }

                    if (disableAnimation) {
                        options.showAnimationDuration = 0;
                    }

                    // Pass data to PhotoSwipe and initialize it
                    gallery = new PhotoSwipe(pswpElement, PhotoSwipeUI_Default, items, options);

                    gallery.listen('imageLoadComplete', function(index, item) {
                        var linkEl = item.el.children[0];
                        var img = item.container.children[0];
                        if (!linkEl.getAttribute('data-size')) {
                            linkEl.setAttribute('data-size', img.naturalWidth + 'x' + img.naturalHeight);
                            item.w = img.naturalWidth;
                            item.h = img.naturalHeight;
                            gallery.invalidateCurrItems();
                            gallery.updateSize(true);
                        }
                    });

                    gallery.init();
                };

                // loop through all gallery elements and bind events
                var galleryElements = document.querySelectorAll(gallerySelector);

                for (var i = 0, l = galleryElements.length; i < l; i++) {
                    galleryElements[i].setAttribute('data-pswp-uid', i + 1);
                    galleryElements[i].onclick = onThumbnailsClick;
                }

                // Parse URL and open gallery if it contains #&pid=3&gid=1
                var hashData = photoswipeParseHash();
                if (hashData.pid && hashData.gid) {
                    openPhotoSwipe(hashData.pid, galleryElements[hashData.gid - 1], true, true);
                }
            };

            // execute above function
            initPhotoSwipeFromDOM(gallerySelector);
        }
        
        
    }

    /*打赏页面隐藏与展示*/
    
    function dashangToggle() {
        $(".shang_box").fadeToggle();
        $(".hide_box").fadeToggle();
    }
    

</script>

<!--加入行号的高亮代码块样式-->

<!--自定义样式设置-->
<style>
    
    
    .nav {
        width: 542px;
    }
    .nav.fullscreen {
        margin-left: -542px;
    }
    .nav-left {
        width: 120px;
    }
    
    
    @media screen and (max-width: 1468px) {
        .nav {
            width: 492px;
        }
        .nav.fullscreen {
            margin-left: -492px;
        }
        .nav-left {
            width: 100px;
        }
    }
    
    
    @media screen and (max-width: 1024px) {
        .nav {
            width: 492px;
            margin-left: -492px
        }
        .nav.fullscreen {
            margin-left: 0;
        }
    }
    
    @media screen and (max-width: 426px) {
        .nav {
            width: 100%;
        }
        .nav-left {
            width: 100%;
        }
    }
    
    
    .nav-right .title-list nav a .post-title, .nav-right .title-list #local-search-result a .post-title {
        color: #383636;
    }
    
    
    .nav-right .title-list nav a .post-date, .nav-right .title-list #local-search-result a .post-date {
        color: #5e5e5f;
    }
    
    
    .nav-right nav a.hover, #local-search-result a.hover{
        background-color: #e2e0e0;
    }
    
    

    /*列表样式*/
    

    /* 背景图样式 */
    
    #post {
        background: url(https://guli-parent-tree-root.oss-cn-hangzhou.aliyuncs.com/2023%3A10%3A23%3Awallpaper1680173153576.jpg);
    }
    
    


    /*引用块样式*/
    

    /*文章列表背景图*/
    

    
    #post .pjax article :not(pre) > code {
        color: #24292e;
        font-family: SFMono-Regular,Consolas,Liberation Mono,Menlo,Courier,monospace;
        background-color: rgba(27,31,35,.05);
        border-radius: 3px;
        font-size: 85%;
        margin: 0;
        padding: .2em .4em;
    }
    
</style>


<!-- Root element of PhotoSwipe. Must have class pswp. -->
<div class="pswp" tabindex="-1" role="dialog" aria-hidden="true">

    <!-- Background of PhotoSwipe.
         It's a separate element, as animating opacity is faster than rgba(). -->
    <div class="pswp__bg"></div>

    <!-- Slides wrapper with overflow:hidden. -->
    <div class="pswp__scroll-wrap">

        <!-- Container that holds slides. PhotoSwipe keeps only 3 slides in DOM to save memory. -->
        <!-- don't modify these 3 pswp__item elements, data is added later on. -->
        <div class="pswp__container">
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
            <div class="pswp__item"></div>
        </div>

        <!-- Default (PhotoSwipeUI_Default) interface on top of sliding area. Can be changed. -->
        <div class="pswp__ui pswp__ui--hidden">

            <div class="pswp__top-bar">

                <!--  Controls are self-explanatory. Order can be changed. -->

                <div class="pswp__counter"></div>

                <button class="pswp__button pswp__button--close" title="Close (Esc)"></button>

                <button class="pswp__button pswp__button--fs" title="Toggle fullscreen"></button>

                <!-- Preloader demo https://codepen.io/dimsemenov/pen/yyBWoR -->
                <!-- element will get class pswp__preloader--active when preloader is running -->
                <div class="pswp__preloader">
                    <div class="pswp__preloader__icn">
                        <div class="pswp__preloader__cut">
                            <div class="pswp__preloader__donut"></div>
                        </div>
                    </div>
                </div>
            </div>

            <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">
                <div class="pswp__share-tooltip"></div>
            </div>

            <button class="pswp__button pswp__button--arrow--left" title="Previous (arrow left)">
            </button>

            <button class="pswp__button pswp__button--arrow--right" title="Next (arrow right)">
            </button>

            <div class="pswp__caption">
                <div class="pswp__caption__center"></div>
            </div>

        </div>

    </div>

</div>






</html>
